package com.gulimall.order;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;

/**
 * 使用RabbitMQ
 * 1、引入starter，RabbitAutoConfiguration就会自动生效
 * 2、给容器中自动配置了
 *      CachingConnectionFactory，RabbitTemplate，AmqpAdmin，RabbitMessagingTemplate
 * 3、@EnableRabbit
 *
 *
 * Seata控制分布式事务
 * 1、每一个微服务先必须创建undo_log表，回滚事务表。
 * 2、安装事务协调器：seata-server
 * 3、整合seata
 *      1、导入依赖 spring-cloud-starter-alibaba-seata   seata-all 0.7.1
 *      2、解压并启动seata服务
 *          registry.conf 注册中心配置
 *      3、所有想要用到分布式事务的未付使用seata DataSourceProxy代理自己的数据源
 *      4、每个微服务，都必须导入
 *          registry.conf
 *          file.conf vgroup_mapping.{application.name}-fescar-service-group = "default"
 *      5、启动测试分布式事务
 *      6、给分布式事务的入口标注@GlobalTransactional
 *      7、每一个远程的小事务用@Transactional
 *
 */
@EnableFeignClients
@EnableDiscoveryClient
@EnableRedisHttpSession
@EnableRabbit
@SpringBootApplication
@MapperScan("com.gulimall.order.dao")
@EnableAspectJAutoProxy(exposeProxy = true)
public class GulimallOrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(GulimallOrderApplication.class, args);
    }

}
